#ifndef _SnatchListScene_h__
#define _SnatchListScene_h__

#include "Global.h"




#include "../ChallengeItem.h"

enum ChallengeTab
{
	TAB_RANDOM=0,
	TAB_ENEMY,
	TAB_FIND,
	TAB_NONE
};
class SnatchListScene
	: public State
	, public CCBMemberVariableAssigner
	, public CCBSelectorResolver
	, public CCNodeLoaderListener
{
public:
	CCB_STATIC_NEW_AUTORELEASE_OBJECT_WITH_INIT_METHOD(SnatchListScene, create);

	SnatchListScene(void);
	~SnatchListScene(void);

	virtual SEL_MenuHandler onResolveCCBCCMenuItemSelector(CCObject * pTarget, CCString * pSelectorName);
	virtual SEL_CCControlHandler onResolveCCBCCControlSelector(CCObject * pTarget, CCString * pSelectorName);
	virtual bool onAssignCCBMemberVariable(CCObject * pTarget, CCString * pMemberVariableName, CCNode * pNode);
	virtual void onNodeLoaded(CCNode * pNode, CCNodeLoader * pNodeLoader);
	bool init();
	void refresh();
	void onEnter();
	void onExit();
private:
	CCScrollView* mScrollView;
	ChallengeTab mCurTab;
    CCControlButton* mFindBtn;
	std::vector<ChallengeItem*> mCurList;
	void _onNotification(CCObject* object);
	void changeTab(ChallengeTab tab);
	void clear();
	void getFindName(std::string& name);
	void onRandomTabClick(CCObject * pSender, CCControlEvent pCCControlEvent);
	void onEnemyTabClick(CCObject * pSender, CCControlEvent pCCControlEvent);
	void onFindTabClick(CCObject * pSender, CCControlEvent pCCControlEvent);
	void onFindBtnClick(CCObject * pSender, CCControlEvent pCCControlEvent);
};

#endif